package main

import (
	"fmt"
	"unsafe"
)

var m1 = 1
var m2 = "ss"
var (
	m3 = "m3"
	m4 = 1
)

func main() {
	fmt.Print("helle go")
	var name string = "aa"
	num := 1.1
	fmt.Println(num)
	fmt.Println(name)
	fmt.Println("----------------")
	var n1, n2, n3 int
	n1 = 1
	n2 = 2
	n3 = 3
	fmt.Println(n1, n2, n3)
	fmt.Println(m1, m2, m3, m4)

	fmt.Println("n2+n1:", n2+n1)

	// uint8 无符号位 0-255
	var u1 uint8 = 255
	fmt.Println("uint8", u1)

	// byte 0-255
	var b1 byte = 254
	fmt.Println(b1)

	var s1 = 100
	fmt.Printf("s1 的类型 %T", s1)

	fmt.Printf("s1 字节大小 %d", unsafe.Sizeof(s1))
	fmt.Println("===============float64 =============")
	var f1 float64 = 0.1
	fmt.Printf("f1 的类型 %T,f1 字节大小 %d", f1, unsafe.Sizeof(f1))

	fmt.Println("===============科学计数法 =============")
	// 5.123 * 100  e/E
	num2 := 5.123e2
	fmt.Println(num2)
	fmt.Printf("num2 的类型 %T,num2 字节大小 %d", num2, unsafe.Sizeof(num2))
	num3 := 5.123e-2
	fmt.Println(num3)

	fmt.Println("===============没有单独字符类型，一般单独字符使用byte =============")
	var c1 byte = 'a'
	var c2 byte = '0'
	fmt.Println(c1) // 97
	fmt.Println(c2) // 48

	fmt.Printf("c1=%c c2=%c", c1, c2)

	//var c3 byte = '男'
	//fmt.Printf("c1=%c",c3) // constant 30007 overflows byte
	var c3 int = '男'
	fmt.Printf("c3=%c c3对应码值=%d", c3, c3) // 男  30007

	var c4 int = 30007
	fmt.Printf("c4=%c c4=%d", c4, c4) // 男  30007

	var c5 int = 10 + 'a'
	fmt.Println("c5=", c5) //107

	fmt.Println("=========字符-->对应码值-->二进制--->存储 =============")
	fmt.Println("=========boolean=============")

}
